package com.sanpu.kxe.business.main.adapter;

import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import com.sanpu.kxe.business.main.bean.UserCenterOutput;
import com.sanpu.kxe.business.main.fragment.MyProfitsFragment;
import com.sanpu.kxe.common.cache.CacheManage;
import com.sanpu.kxe.common.cache.CacheModel;

import java.util.ArrayList;

/**
 * Description：我的盟友收益列表
 * Created by 薛勇军 on 2018/8/7.
 */

public class ProfitsPagerAdapter extends FragmentPagerAdapter {

    ArrayList<MyProfitsFragment> fragments = new ArrayList<>();

    public ProfitsPagerAdapter(FragmentManager fm) {
        super(fm);
        UserCenterOutput centerOutput = CacheManage.getInstance().getCache(CacheModel.USER_CENTER_KEY);
        String merchantCode = "", accountName = "";
        if (centerOutput != null) {
            merchantCode = centerOutput.getMerchantCode();
            accountName = centerOutput.getUserName();
        }
        fragments.add(MyProfitsFragment.getInstance(0, merchantCode, accountName));
        fragments.add(MyProfitsFragment.getInstance(1, "", ""));
        fragments.add(MyProfitsFragment.getInstance(2, "", ""));
    }

    @Override
    public MyProfitsFragment getItem(int position) {
        return fragments.get(position);
    }

    @Override
    public int getCount() {
        return fragments.size();
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return "";
    }
}
